const { MongoClient } = require('mongodb')

const client = new MongoClient('mongodb://localhost:27017/', { useUnifiedTopology: true })

async function run() {
    try {
        await client.connect()
        const abcDB = client.db('abc')

        const inventoryCollection = abcDB.collection('inventory')
        // 创建文档  
        const res = await inventoryCollection.find().toArray()
        console.log(res);
    } catch (err) {
        console.log(err)
    } finally {
        await client.close()
    }
}
run()

console.log([1, 2, '1','11238'].map(parseInt))